package com.eastmoney.emis.edda.domain.valueobject;

/**
 * @description: 0:未处理,1:处理中,2:申请成功,3:手工作废,4:申请失败,5:OTP未确认
 * @projectName: EDDA-HSBC
 * @package: com.eastmoney.emis.edda.domain.valueobject
 * @author: 汪程程
 * @date: 2022/10/10 5:20 PM
 * @version: 1.0
 */
public enum EddaApplyStatus {

    INIT("0"),

    PROCESSING("1"),

    SUCCESS("2"),

    INVALID("3"),

    FAIL("4"),
    SET_UP_FAIL("40"),

    OTP_UNCONFIRMED("5");

    private final String value;

    EddaApplyStatus(String value) {
        this.value = value;
    }

    public String value() {
        return value;
    }

    public static EddaApplyStatus parse(String value) {
        for (EddaApplyStatus eddaApplyStatus : EddaApplyStatus.values()) {
            if(eddaApplyStatus.value().equals(value)) {
                return eddaApplyStatus;
            }
        }
        throw new IllegalArgumentException("未知 EddaApplyStatus: " + value);
    }

    public String generateName() {
        return this.name().toLowerCase().replace("_", "-");
    }
}
